package com.heima.utils.thread;

import com.heima.model.user.pojos.ApUser;

/**
 * app端的ThreadLocal工具类
 *
 * @author DiXiaoNie
 * @date 2022/12/21
 * @since 2022/12/21 15:59
 */

public class ApThreadLocalUtil {

    /**
     * wm用户当前线程
     */
    private static final ThreadLocal<ApUser> AP_USER_THREAD_LOCAL = new ThreadLocal<>();


    /**
     * 设置用户线程本地wm
     *
     * @param apUser wm用户
     * @author DiXiaoNie
     * @date 2022/12/21
     */
    public static void setApUserThreadLocal(ApUser apUser) {
        AP_USER_THREAD_LOCAL.set(apUser);
    }

    /**
     * 得到用户线程本地wm
     *
     * @return {@link ApUser }
     * @author DiXiaoNie
     * @date 2022/12/21
     */
    public static ApUser getApUserThreadLocal() {
        return AP_USER_THREAD_LOCAL.get();
    }

    /**
     * 删除用户线程本地wm
     *
     * @author DiXiaoNie
     * @date 2022/12/21
     */
    public static void deleteApUserThreadLocal() {
        AP_USER_THREAD_LOCAL.remove();

    }


}
